package com.fishingwithme.domain.settings;

import com.fishingwithme.infrastructure.utils.CommonUtils;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.databind.node.ObjectNode;

public enum FeedbackType {
    FEATURE_SUGGESTION("功能建议"),
    EXPERIENCE_ISSUE("体验问题"),
    UI_OPTIMIZATION("界面优化"),
    VIOLATION_REPORT("违规举报"),
    CONTENT_REPORT("内容举报"),
    MINOR_ISSUE("未成年问题"),
    ACCOUNT_SECURITY("账号安全"),
    OTHER_ISSUE("其他问题");

    private final String name;
    @EnumValue
    private final String code;

    FeedbackType(String name) {
        this.code = name();
        this.name = name;
    }

    public String getName() {
        return this.name;
    }

    @JsonValue
    public String getCode() {
        return this.code;
    }

    public ObjectNode toJson() {
        ObjectNode json = CommonUtils.objectMapper.createObjectNode();
        json.put("code", this.name());
        json.put("name", this.name);
        return json;
    }
}
